<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title>
</head>

<script language="javascript">
var num = 1;
 function add_row()
 {
  var tab = document.getElementByIdx_x('tbl');
  var tRow = tab.rows.length; 
  var _tr=tab.insertRow(tRow);
 
  var _td=_tr.insertCell(0); 
  _td.width="10%";
  _td.innerHTML ="名称";
 
 
  var _td=_tr.insertCell(1);
  var t=document.createElement_x("input");
  t.size=20;
  t.name="part_title["+num+"]";
  _td.width="20%";
  _td.appendChild(t);
 
 
  var _td=_tr.insertCell(2);
  var t=document.createElement_x("input");
  t.type = "button";
  t.value = "移除";
  t.name = "trs["+num+"]";
  t.onclick = removeTr;
  _td.appendChild(t);
  num++;
 }
 
 //删除tr
 function removeTr(){
  var tab = document.getElementByIdx_x('tbl');
  tab.deleteRow(1);
 }
</script>
<body>
  <input type="button" value="添加" onclick="add_row()"/>
 <table width="100%" id="tbl" border="0" cellpadding="0" cellspacing="0" class="tableborder">           
 <tr>
     <td colspan="10"></td>
 </tr> 
</table>
</body>
</html>